package cn.northsea.mapper;

import cn.northsea.pojo.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.sql.Date;
import java.util.List;

@Repository
public interface OrderMapper {
    @Insert("INSERT into erp_order values " +
            "(null,#{format},#{money},1,#{orderAddress}," +
            "#{orderUphone},#{productvoId},#{id})")
    void addOrder(@Param("money") Double money,
                  @Param("productvoId") Integer productvoId,
                  @Param("format") Date format,
                  @Param("id") Integer id,
                  @Param("orderAddress") String orderAddress,
                  @Param("orderUphone") String orderUphone);

    List<Order> findAll(@Param("start") String start, @Param("end") String end);


    List<Order> findAll1(@Param("userId") Integer userId,
                         @Param("start") String start,
                         @Param("end") String end);

    @Update("update erp_order set order_state=0 where order_id=#{value}")
    void refund(Integer id);
}
